package homework6;

import java.util.*;

/**
 * @classname:AccountTest
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/14 19:46
 * @version: 0.1
 * @since:1.8
 */
public class AccountTest {
    public static void main(String[] args) {
        List<Account> list = new ArrayList<>();

        Collections.addAll(list,
                new Account(10.00, "1234"),
                new Account(15.00, "1234"),
                new Account(0, "5678")
        );

        HashMap<Long, Account> map = new HashMap<>(16);

        list.forEach((lists) -> {
            long id = lists.getId();
            map.put(id, lists);
        });

        Set<Map.Entry<Long, Account>> entries = map.entrySet();
        entries.forEach((entry) -> {
                    System.out.println("id:" + entry.getKey() + "\t余额:" + entry.getValue());
                }
        );
    }
}
